package com.glsc.ngateway.platform.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author guoj
 * @description: 测试用例
 * @date 2024/7/16 9:37
 */
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Data
@Entity
@Table(name = "t_requirement_test_case")
public class RequirementTeskCase {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "l_id", columnDefinition = "int comment '唯一编号'")
    private Long id;

    @Column(name = "l_test_task_id", columnDefinition = "int comment '测试任务的唯一编号'")
    private Long testTaskId;

    @Column(name = "vc_testcase_worktime", columnDefinition = "varchar(10) comment '测试用例工时'")
    private String testCaseWorkTime;


    @ApiModelProperty(value = "需求流程id")
    @Column(name = "vc_requirement_id", columnDefinition = "varchar(60) comment '需求流程id'")
    private String requirementId;

    @ApiModelProperty(value = "测试流程id")
    @Column(name = "vc_process_id", columnDefinition = "varchar(60) comment '测试流程id'")
    private String processId;

    @ApiModelProperty(value = "发起人姓名")
    @Column(name = "flow_create_operator_name", columnDefinition = "varchar(60) comment '发起人姓名'")
    String flowCreateOperatorName;
    @ApiModelProperty(value = "发起人账号oa")
    @Column(name = "flow_create_operator_account", columnDefinition = "varchar(60) comment '发起人账户'")
    String flowCreateOperatorAccount;
    @ApiModelProperty(value = "发起人部门名称")
    @Column(name = "flow_creator_department", columnDefinition = "varchar(255) comment '发起人部门名称'")
    String flowCreatorDepartment;
    @ApiModelProperty(value = "测试用例操作人oa")
    @Column(name = "vc_operator", columnDefinition = "varchar(60) comment '测试用例操作人oa'")
    private String operator;

    @ApiModelProperty(value = "测试用例操作人名字")
    @Column(name = "vc_operator_name", columnDefinition = "varchar(60) comment '测试用例操作人'")
    private String operatorName;

    @ApiModelProperty(value = "测试通过时间")
    @Column(name = "test_pass_time", columnDefinition = "datetime comment '测试通过时间'")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    protected LocalDateTime testPassTime;

    @ApiModelProperty(value = "发起时间")
    @org.hibernate.annotations.UpdateTimestamp
    @Column(name = "dt_process_create_time", columnDefinition = "datetime comment '发起时间'")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime processCreateTime;

    @ApiModelProperty(value = "更新时间")
    @org.hibernate.annotations.UpdateTimestamp
    @Column(name = "dt_update_time", columnDefinition = "datetime comment '更新时间'")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    protected LocalDateTime updateTime;

    @ApiModelProperty(value = "测试用例标题（描述）")
    @Column(name = "vc_case_title", columnDefinition = "varchar(1000) comment '测试用例标题（描述）'")
    private String caseTitle;
    @ApiModelProperty(value = "测试用例步骤")
    @Column(name = "vc_case_content", columnDefinition = "varchar(6000) comment '测试用例步骤'")
    private String caseContent;

    @ApiModelProperty(value = "用例分类")
    @Column(name = "case_type", columnDefinition = "varchar(10) comment '用例分类'")
    private String caseType;

    @ApiModelProperty(value = "测试用例数据类型")
    @Column(name = "case_data_type", columnDefinition = "varchar(10) comment '测试用例数据类型'")
    private String caseDataType;

    @ApiModelProperty(value = "测试用例前提条件")
    @Column(name = "case_before_condition", columnDefinition = "varchar(2000) comment '测试用例前提条件'")
    private String caseBeforeCondition;

    @ApiModelProperty(value = "测试用例预期结果")
    @Column(name = "case_expect_result", columnDefinition = "varchar(2000) comment '测试用例预期结果'")
    private String caseExpectResult;

    @ApiModelProperty(value = "测试用例状态 1-通过 0-不通过")
    @Column(name = "vc_status", columnDefinition = "varchar(10) comment '测试用例状态 1-通过 0-不通过'")
    private String status;
    @ApiModelProperty(value = "备注")
    @Column(name = "vc_remark", columnDefinition = "varchar(1000) comment '备注'")
    private String remark;

//    @ApiModelProperty(value = "测试用例列表")
//    @Transient
//    private List<RequirementTeskCase> testCaseList;
}
